package com.example.udpDemo.socket.event;

import com.example.udpDemo.socket.udp.NettyPacket;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * Description: 事件发布器
 *
 * @author sjt Administrator
 * @since 2023/11/30 10:14
 */
@Component
public class NettyEventPublisher {
    @Resource
    private ApplicationEventPublisher applicationEventPublisher;

    /**
     *
     *
     * @param nettyPackets   nettyPackets
     * @auther sjt Administrator
     * @since 2023/11/30 10:17
     */
    public void publishEvent(List<NettyPacket> nettyPackets) {
        NettyPacketEvent customEvent = new NettyPacketEvent(this, nettyPackets);
        applicationEventPublisher.publishEvent(customEvent);
    }
}
